package com.franklin.springbootdemo;

import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class SimpleServiceImpl implements ISimpleService {
    @Override
    public Map<String, Object> getMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("SimpleServiceImpl.getMap.1", "value");
        map.put("SimpleServiceImpl.getMap.2", 2);
        map.put("SimpleServiceImpl.getMap.3", getListMap1());
        return map;
    }

    private Map<String, Object> getMap1(){
        Map<String, Object> map = new HashMap<>();
        map.put("SimpleServiceImpl.getMap1.1", 1);
        map.put("SimpleServiceImpl.getMap1.2", 2);
        map.put("SimpleServiceImpl.getMap1.3", getListMap2());
        return map;
    }

    private Map<String, Object> getMap2(){
        Map<String, Object> map = new HashMap<>();
        map.put("SimpleServiceImpl.getMap2.1", 1);
        map.put("SimpleServiceImpl.getMap2.2", 2);
        return map;
    }

    private List<Map<String,Object>> getListMap1(){
        return Lists.newArrayList(getMap1());
    }

    private List<Map<String,Object>> getListMap2(){
        return Lists.newArrayList(getMap2());
    }
}
